package com.sunjy.common.utils;

import java.math.BigDecimal;

public class NoUtil {

	public static int getInt(BigDecimal money) {// 向上进位至角位
		float f = money.floatValue();
		return (int) f;
	}

	public static float getFloat(BigDecimal money) {// 向上进位至角位
		float f = money.floatValue();
		int fInt = getInt(money);
		BigDecimal b1 = new BigDecimal(Float.toString(f));
		BigDecimal b2 = new BigDecimal(Integer.toString(fInt));
		float fPoint = b1.subtract(b2).floatValue();
//		System.out.println("整数部分为:" + fInt + "\n" + "小数部分为: " + fPoint);

		return fPoint;
	}


	public static int getJiao(BigDecimal money) {// 向上进位至角位
		float f = getFloat(money);
		BigDecimal b2 = new BigDecimal(Float.toString(f));
		b2.movePointRight(1);
		return b2.movePointRight(1).intValue();
	}


	public static int getFen(BigDecimal money) {// 向上进位至角位
		float f = getFloat(money);
		BigDecimal b2 = new BigDecimal(Float.toString(f));
		return b2.movePointRight(2).intValue()%10;
	}

	public static void main(String[] args) {
		BigDecimal money = new BigDecimal(12.04);
		System.out.println(getFen(new BigDecimal(getFloat(money))));
	}
}
